package com.threeox.commonlibrary.util;

import android.app.Activity;
import android.content.Context;

import com.threeox.commonlibrary.ui.view.OverallInitView;
import com.threeox.commonlibrary.ui.view.loadview.ILoadDialog;
import com.threeox.utillibrary.util.ActivityHelper;

/**
 *
 * @ClassName: ActivityUtils
 *
 * @Description: (Activity相关工具类)
 *
 * @author 赵屈犇
 *
 * @date 创建时间:2016/12/19 15:44
 *
 * @version 1.0
 */
public class ActivityUtils extends ActivityHelper {

    private ILoadDialog mLoadDialog;

    public static ActivityUtils init(Context context, Class cls) {
        return new ActivityUtils(context, cls);
    }

    private ActivityUtils(Context context, Class cls) {
        super(context, cls);
        if (context instanceof Activity) {
            mLoadDialog = OverallInitView.newInstance(context).initOverallLoadDialog();
            mLoadDialog.setMessage("正在打开...");
            mLoadDialog.setCancelable(false);
            mLoadDialog.setCanceledOnTouchOutside(false);
        }
    }

    @Override
    public ActivityHelper start() {
        DialogUtil.dismissDialog(mLoadDialog);
        return super.start();
    }

    @Override
    public ActivityHelper start(int requestCode) {
        DialogUtil.dismissDialog(mLoadDialog);
        return super.start(requestCode);
    }
}
